
#include "key.h"
#include "port.h"

enum e_ctrl
{
    e_ctrl_led__test,
    e_ctrl_flowing_water_lamp,
    e_ctrl_beep,
    e_ctrl_nixie_tube_choose,
    e_ctrl_nixie_tube_ctrl,
    e_ctrl_key_scan,
    e_ctrl_key_matrix_scan,
    e_ctrl_key_matrix_flip,
};

void handle(enum e_ctrl type)
{
    switch (type)
    {
        case e_ctrl_led__test:
        {
            led1_ctrl();
            break;
        }

        case e_ctrl_flowing_water_lamp:
        {
            led_flowing_water_lamp();
            break;
        }

        case e_ctrl_beep:
        {
            beep_ctrl();
            break;
        }

        case e_ctrl_nixie_tube_choose:
        {
            nixie_tube_choose(1, 0x1);
            break;
        }

        case e_ctrl_nixie_tube_ctrl:
        {
            nixie_tube_ctrl();
            break;
        }

        case e_ctrl_key_scan:
        {
            key_scan();
            break;
        }

        case e_ctrl_key_matrix_scan:
        {
            
            key_matrix_check_scan();
            break;
        }

        case e_ctrl_key_matrix_flip:
        {
            key_matrix_check_flip();
            break;
        }
        
        default:break;
    }
}

int main(void)
{
    //nixie_tube_choose(1, 0x0);
    while(1)
    {
        handle(e_ctrl_key_matrix_flip);
    }
    return 0;
}